package net.jiug.common.web.base;

import net.jiug.common.config.ConfigSecretKey;
import net.jiug.common.exception.BadRequestException;

import javax.annotation.Resource;
import java.util.Set;
import java.util.logging.Logger;

public class BaseController {

    protected static final Logger logger = Logger.getLogger(BaseController.class.getName());

    @Resource
    protected ConfigSecretKey configSecretKey;

    protected void securityVerification(String uuid) throws Exception{
        Set<String> requestSecretKey = configSecretKey.getRequestSet();
        if(!requestSecretKey.contains(uuid)){
            String errorMessage = "uuid不存在";
            logger.severe(errorMessage);
            throw new BadRequestException(errorMessage);
        }
    }

}
